<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>jQuery UI 定位（Position） - 默认功能</title>
  <link rel="stylesheet" href="//apps.bdimg.com/libs/jqueryui/1.10.4/css/jquery-ui.min.css">
  <script src="//apps.bdimg.com/libs/jquery/1.10.2/jquery.min.js"></script>
  <script src="//apps.bdimg.com/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
  <link rel="stylesheet" href="jqueryui/style.css">
  <style>
  #parent {
    width: 60%;
    height: 40px;
    margin: 10px auto;
    padding: 5px;
    border: 1px solid #777;
    background-color: #fbca93;
    text-align: center;
  }
  .positionable {
    position: absolute;
    display: block;
    right: 0;
    bottom: 0;
    background-color: #bcd5e6;
    text-align: center;
  }
  #positionable1 {
    width: 75px;
    height: 75px;
  }
  #positionable2 {
    width: 120px;
    height: 40px;
  }
  select, input {
    margin-left: 15px;
  }
  </style>
  <script>
  $(function() {
    function position() {
      $( ".positionable" ).position({
        of: $( "#parent" ),
       my: "right top",
				        at: "right top",
				        collision: "none none"
      /*
        of: $( "li" ),
				        my: "right top",
				        at: "right top",
				        collision: "none none"
       * 
       * */
      });
    }
 
    $( ".positionable" ).css( "opacity", 0.5 );
 
    $( ".parent" ).draggable({
      drag: function(){
      	  $( "#positionable1" ).position({
        of: $( ".parent:first" ),
       my: "right top",
		at: "right top",
		 collision: "none none"
   
      });
      }
    });
 
//  position();
  });
  </script>
</head>
<body>
 
<div id="parent" class="parent">
  <p>
  这是父元素的位置。
  </p>
</div>
 <div id="parent" class="parent">
  <p>
  这是父元素的位置。
  </p>
</div>
<div class="positionable" id="positionable1">
  <p>
  to position1
  </p>
</div>
 <div class="positionable" id="positionable2">
  <p>
  to position
  </p>
</div>
 
 
 
</body>
</html>